/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * cpa_ver_avaliacao.java
 *
 * Created on 26/05/2010, 16:28:02
 */

package siga.visao_cpa;

import javax.swing.JOptionPane;
import siga.criptografia.md5;
import siga.navegadores.navegador;
import siga.visao_busca.buscaCpaAvaliacao;
import siga.visao.index;

/**
 *
 * @author rafaelfrasson
 */
public class cpa_ver_avaliacao extends javax.swing.JDialog {

    /** Creates new form cpa_ver_avaliacao */
    public cpa_ver_avaliacao(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jtfCod_avaliacao = new javax.swing.JTextField();
        jtfDesc_avaliacao = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Ver Avaliação - CAP");

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/siga/imagem/printer_32.png"))); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel1.setText("Avaliação:");
        jLabel1.setName("jLabel1"); // NOI18N

        jtfCod_avaliacao.setEnabled(false);
        jtfCod_avaliacao.setName("jtfCod_avaliacao"); // NOI18N

        jtfDesc_avaliacao.setEnabled(false);
        jtfDesc_avaliacao.setName("jtfDesc_avaliacao"); // NOI18N

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/siga/imagem/busca_16x16.png"))); // NOI18N
        jButton3.setToolTipText("Busca somente Docentes");
        jButton3.setFocusable(false);
        jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jButton3.setName("jButton3"); // NOI18N
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButton1)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jtfCod_avaliacao, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jtfDesc_avaliacao, javax.swing.GroupLayout.PREFERRED_SIZE, 416, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton3)))
                .addContainerGap(28, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButton3)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jtfCod_avaliacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jtfDesc_avaliacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButton1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if(!jtfCod_avaliacao.getText().equals("")){
//            navegador.URL("http://localhost/Fucap/projeto_cpa/index.php?codigo="+jtfCod_avaliacao.getText()+"&chave="+md5.crpMD5("MinhaMaeMandouIrA99012"));
            navegador.URL("http://201.35.207.198/projeto_cpa/index.php?codigo="+jtfCod_avaliacao.getText()+"&chave="+md5.crpMD5("MinhaMaeMandouIrA99012"));
        }else{
            JOptionPane.showMessageDialog(null, "Favor selecionar uma Avaliação", "Alerta do sistema", JOptionPane.INFORMATION_MESSAGE);
        }
    }//GEN-LAST:event_jButton1ActionPerformed

    @SuppressWarnings("static-access")
    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        buscaCpaAvaliacao bca = new buscaCpaAvaliacao(null,true);
        bca.setLocation((index.tela.width-bca.getWidth())/2, (index.tela.height-bca.getHeight())/2);
        bca.setVisible(true);
        if(bca.bcpaa_finaliza){
            jtfCod_avaliacao.setText(bca.bcpaa_dados.get(0).toString());
            jtfDesc_avaliacao.setText(bca.bcpaa_dados.get(1).toString());
            bca.bcpaa_dados.clear();
        }
}//GEN-LAST:event_jButton3ActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JTextField jtfCod_avaliacao;
    private javax.swing.JTextField jtfDesc_avaliacao;
    // End of variables declaration//GEN-END:variables

}
